package com.ngc.mall.common.configure.token;

import com.ngc.mall.util.DoubleJWT;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *  token配置类
 *
 * @author : Chen Xiao Lin
 * @Date : 2023/4/6 16:48
 **/

@Configuration
public class TokenConfiguration {
    /**
     * 实例化双令牌
     * @return
     */
    @Bean
    public DoubleJWT jwter() {
        Long accessExpire = null;
        Long refreshExpire =null;
        if (accessExpire == null) {
            // 一个小时
            accessExpire = 60 * 60L;
        }
        if (refreshExpire == null) {
            // 一个月
            refreshExpire = 60 * 60 * 24 * 30L;
        }
        return new DoubleJWT("ngcTest", accessExpire, refreshExpire);
    }

}
